<html>
<head>
	<meta charset="UTF-8">
	<title>axios-全局设置</title>
	<script type="text/javascript" src="./axios.js"></script>
</head>
<body>

<script type="text/javascript">
axios.defaults.baseURL = '/api/'; // 配置axios请求的前缀地址
axios.defaults.timeout = 5000;//超时时间

//设置单个请求头-1
axios({
    method: 'get',
    url: '/user/test1',
    data: {
    	'param1': 'value1',
    	'param2': 'value2',
    }
});
//设置单个请求头-2
axios.post('/user/test2', {
	'param1': 'value1',
	'param2': 'value2',
});
</script>
</body>
</html>